<?php


namespace app\operates\controller;


use PhpOffice\PhpSpreadsheet\IOFactory;
use think\facade\View;

class Index
{
    public function onShow()
    {
        $param=request()->param();
//        $path=request()->domain().$param['path']??'';
        $path='http://test.qjhospital.fengyikeji.top'.$param['path']??'';
        $path=urlencode($path);
//        $path='http://test.qjhospital.fengyikeji.top'.'/storage/202503/20250317\8a6b9432a968509ee8a272a9bb6008e1.docx';
//        halt($path);
        $thml=<<<pod
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Display Word Document</title>
</head>
<body>
    <!-- 使用data URL直接在iframe中显示 -->
    <iframe src="https://view.officeapps.live.com/op/embed.aspx?src={$path}" width="100%" height="1080px"></iframe>
</body>
</html>
pod;
echo $thml;
exit();
//        View::assign('path',request()->domain().$path);
//        return view();
}

function fileToBase64($file=''){
        $baseFile='';
        if (file_exists($file)){
            $minType=mime_content_type($file);
            $baseData=base64_decode(file_get_contents($file));
//            $baseFile='data:'.$minType.';base64,'.$baseData;
            $baseFile=$baseData;
        }

        return $baseFile;
}
}